package render

import (
	// "qf-open/pkg/util"
	"github.com/go-chi/render"
)

func StringToRender(s string) render.Renderer {
	// Pre-processing before a response is marshalled and sent across the wire
	return &AppBaseResponse{HTTPStatusCode: 200, StatusText: "ok", Data: s}
}

func ObjectToRender[T any](s T) render.Renderer {
	// Pre-processing before a response is marshalled and sent across the wire
	return &AppBaseResponse{HTTPStatusCode: 200, StatusText: "ok", Data: s}
}

func ListToRender[T any](i []T) render.Renderer {
	// Pre-processing before a response is marshalled and sent across the wire
	// make json output {rows:null => rows: []}
	if len(i) == 0 {
		i = make([]T, 0)
	}
	return &AppBaseResponse{HTTPStatusCode: 200, StatusText: "ok", Data: i}
}
